package cn.sang.service.imp;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;

import cn.sang.dao.TeacherDao;
import cn.sang.model.Teacher;
import cn.sang.service.TeacherService;
import cn.sang.util.StrUtils;

@Service
public class TeacherServiceImp implements TeacherService{

	@Resource
	private TeacherDao teacherDao;
	
	/**
	 *  首页教师列表
	 */
	public List<Teacher> indexTeacherList(HttpServletRequest request) {
		
		List<Teacher> indexList = teacherDao.indexTeacherList();
		
		return indexList;
	}

	// 根据教师id查询信息
	public Teacher getTeacherById(HttpServletRequest request) {
		String teacherId_str = request.getParameter("tId");
		
		Integer teacherId = null;
		if(StrUtils.isNotEmpty(teacherId_str)){
			teacherId = Integer.valueOf(teacherId_str);
		}
		
		Teacher teacher = teacherDao.getTeacherById(teacherId);
		
		return teacher;
	}
	
	
	
	
}
